package com.woniuxy.hotel.room.util;/**
 * @Author ：Cheng Yl
 * @Date ：Created in 2019/8/2 15:56
 */

/**
 * @ClassName PageInfo
 * @Description TODO
 * @Author Cheng Yl
 * @Date 2019/8/2 15:56
 */
public class PageInfo {
    private Integer page;
    private Integer startIndex;
    private Integer limit;
    
    /**
     * 参数可为空(null)
     * @param page
     * @param startIndex
     * @param limit
     */
    public PageInfo (Integer page, Integer startIndex, Integer limit) {
        if (page != null) {
            this.page = page;
        }
        if (limit != null) {
            this.limit = limit;
        }
        if (startIndex != null) {
            this.startIndex = startIndex;
        }
    }
    
    /**
     * 自动完成startIndex
     *
     * @param page  页数
     * @param limit 每页数量
     */
    public PageInfo (Integer page, Integer limit) {
        this.page = page;
        this.limit = limit;
        this.startIndex = (page - 1) * limit;
    }
    
    public PageInfo () {
    }
    
    public Integer getPage () {
        return page;
    }
    
    public void setPage (Integer page) {
        this.page = page;
    }
    
    public Integer getLimit () {
        return limit;
    }
    
    public void setLimit (Integer limit) {
        this.limit = limit;
    }
    
    public Integer getStartIndex () {
        return startIndex;
    }
    
    public void setStartIndex (Integer startIndex) {
        this.startIndex = startIndex;
    }
}
